<template>
    <div>
        <h3>sub当前最新count值为：{{count}}</h3>
        <h3>{{showNum}}</h3>
            <button @click="subcount">-1</button>
            <button @click="subcountN">-N</button>
            <button @click="subcountAsync">-1 async</button>
            <button @click="subcountAsyncN">-N async</button>
    </div>
</template>

<script>
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
export default {
  data () {
    return {}
  },
  computed: {
    ...mapState(['count']),
    ...mapGetters(['showNum'])
  },
  methods: {
    ...mapMutations(['sub', 'subN']),
    ...mapActions(['subcountAsynca', 'subcountAsyncNa']),
    subcount () {
      this.sub()
    },
    subcountN () {
      this.sub(3)
    },
    subcountAsync () {
      this.subcountAsynca()
    },
    subcountAsyncN () {
      this.subcountAsyncNa(6)
    }
  }
}
</script>
